$OpenBSD: patch-Makefile,v 1.5 2016/01/06 09:49:43 jasper Exp $
--- Makefile.orig	Mon May  4 04:54:46 2015
+++ Makefile	Tue Jan  5 21:25:42 2016
@@ -11,30 +11,29 @@ DINSTALLLIB=$(DESTDIR)$(INSTALLLIB)
 DINSTALLMAN=$(DESTDIR)$(INSTALLMAN)
 DINSTALLINCLUDE=$(DESTDIR)$(INSTALLINCLUDE)
 
-MAJOR=$(shell sh version.sh --major)
+MAJOR?=$(shell sh version.sh --major)
+MINOR?=$(shell sh version.sh --revision)
 VERSION=$(shell sh version.sh)
+LIBVER?=$(MAJOR).$(MINOR)
 
 WARNFLAGS+=-pedantic -Wall -W -Wundef \
            -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast \
            -Wcast-align -Wwrite-strings -Wstrict-prototypes \
            -Wmissing-prototypes -Wnested-externs -Winline \
            -Wdisabled-optimization -Wno-missing-field-initializers
-LIBSUFFIX=$(shell sh platform.sh libsuffix)
-VERLIBSUFFIX=$(shell sh platform.sh libsuffix $(MAJOR))
+LIBSUFFIX=$(shell sh platform.sh libsuffix $(LIBVER))
 DYNLIBFLAG=$(shell sh platform.sh dynlibflag)
-LIBNAMEFLAG=$(shell sh platform.sh libnameflag $(MAJOR) $(INSTALLLIB))
 
 CFLAGS?=-pipe -O2 $(WARNFLAGS)
-CFLAGS+=-g # TODO(sissel): Comment before release
 CFLAGS+=$(CPPFLAGS)
 
-DEFAULT_LIBS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst -lXinerama
-DEFAULT_INC=-I/usr/X11R6/include -I/usr/local/include
+DEFAULT_LIBS=-L${X11BASE}/lib -L${PREFIX}/lib -lX11 -lXtst -lXinerama
+DEFAULT_INC=-I${X11BASE}/include -I${PREFIX}/include
 
 XDOTOOL_LIBS=$(shell pkg-config --libs x11 2> /dev/null || echo "$(DEFAULT_LIBS)")  $(shell sh platform.sh extralibs)
 LIBXDO_LIBS=$(shell pkg-config --libs xtst xinerama xkbcommon 2> /dev/null || echo "$(DEFAULT_LIBS)")
-INC=$(shell pkg-config --cflags x11 xtst xinerama 2> /dev/null || echo "$(DEFAULT_INC)")
-CFLAGS+=-std=c99 $(INC)
+INC=$(shell pkg-config --cflags x11 xtst xinerama xkbcommon 2> /dev/null || echo "$(DEFAULT_INC)")
+CFLAGS+=-std=c99 $(WARNFLAGS) $(INC)
 
 CMDOBJS= cmd_click.o cmd_mousemove.o cmd_mousemove_relative.o cmd_mousedown.o \
          cmd_mouseup.o cmd_getmouselocation.o cmd_type.o cmd_key.o \
@@ -52,7 +51,7 @@ CMDOBJS= cmd_click.o cmd_mousemove.o cmd_mousemove_rel
          cmd_sleep.o cmd_get_display_geometry.o
 
 .PHONY: all
-all: xdotool.1 libxdo.$(LIBSUFFIX) libxdo.$(VERLIBSUFFIX) xdotool
+all: xdotool.1 libxdo.$(LIBSUFFIX) xdotool
 
 .PHONY: static
 static: xdotool.static
@@ -84,23 +83,22 @@ post-install:
 .PHONY: installprog
 installprog: xdotool
 	install -d $(DINSTALLBIN)
-	install -m 755 xdotool $(DINSTALLBIN)/
+	${INSTALL_PROGRAM} xdotool $(DINSTALLBIN)/
 
 .PHONY: installlib
 installlib: libxdo.$(LIBSUFFIX)
 	install -d $(DINSTALLLIB)
-	install libxdo.$(LIBSUFFIX) $(DINSTALLLIB)/libxdo.$(VERLIBSUFFIX)
-	ln -sf libxdo.$(VERLIBSUFFIX) $(DINSTALLLIB)/libxdo.$(LIBSUFFIX)
+	${INSTALL_DATA} libxdo.$(LIBSUFFIX) $(DINSTALLLIB)/
 
 .PHONY: installheader
 installheader: xdo.h
 	install -d $(DINSTALLINCLUDE)
-	install xdo.h $(DINSTALLINCLUDE)/xdo.h
+	${INSTALL_DATA} xdo.h $(DINSTALLINCLUDE)/xdo.h
 
 .PHONY: installman
 installman: xdotool.1
 	install -d $(DINSTALLMAN)/man1
-	install -m 644 xdotool.1 $(DINSTALLMAN)/man1/
+	${INSTALL_MAN} xdotool.1 $(DINSTALLMAN)/man1/
 
 .PHONY: deinstall
 deinstall: uninstall
@@ -131,7 +129,7 @@ xdo.c: xdo.h
 xdotool.c: xdo.h
 
 libxdo.$(LIBSUFFIX): xdo.o xdo_search.o
-	$(CC) $(LDFLAGS) $(DYNLIBFLAG) $(LIBNAMEFLAG) xdo.o xdo_search.o -o $@ $(LIBXDO_LIBS)
+	$(CC) $(LDFLAGS) $(DYNLIBFLAG) xdo.o xdo_search.o -o $@ $(LIBXDO_LIBS)
 
 libxdo.a: xdo.o xdo_search.o
 	ar qv $@ xdo.o xdo_search.o
@@ -172,7 +170,7 @@ package-deb: test-package-build create-package-deb
 
 .PHONY: test
 test: WITH_SHELL=/bin/bash
-test: xdotool libxdo.$(VERLIBSUFFIX)
+test: xdotool libxdo.$(LIBSUFFIX)
 	echo $(WITH_SHELL)
 	if [ "$(WITH_SHELL)" = "/bin/sh" ] ; then \
 		echo "Shell '$(WITH_SHELL)' fails on some Linux distros because it could"; \
